#define _CRT_SECURE_NO_WARNINGS
#pragma warning(disable:6031)

#include <stdio.h>
#include <math.h>

long long sum(int arr[], long long left, long long right)
{
	long long i = 0;
	long long sum = 0;
	for (i = left; i <= right; i++)
	{
		sum = sum + arr[i];
	}
	return sum;
}

long long search(int arr[], long long left, long long right)
{
	long long sum1 = 0;
	long long sum2 = 0;

	if (left <= right)
	{
		
			sum1 = sum(arr, left, (left + right) / 2);
			sum2 = sum(arr, (left + right) / 2 + 1, right);
			if (sum1 > sum2)
			{
				return search(arr, (left + right) / 2 + 1, right);
			}
			else if (sum1 < sum2)
			{
				return search(arr, left, (left + right) / 2);

			}
			else
			{
				return (left + right) / 2;
			}
		
	}
	

}

int main()
{
	int N = 0;
	long long n = 0;
	int arr[1000] = { 0 };
	long long i = 0;
	long long index = 0;
	
	long long left = 0;
	long long right = 0;

	scanf("%d", &N);
	n = (long long)pow(2.0, (double)N);
	right = n - 1;
	for (i = 0; i < n; i++)
	{
		scanf("%d", &arr[i]);
	}

	index = search(arr, left, right);

	printf("%lld", index);

	return 0;
}

//5, 32
//
/*
1 1 1 1 1 
1 1 1 1 1
1 1 1 1 1 
1 1 1 1 1  
1 1 1 1 1
1 1 1 1 1
1 

*/

//6, 64
//
/*
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1
1 1 1 1 1
1 1 0 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 

*/

//7, 128
//
/*
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 0

*/